<template>
  <view class="consultant-page">
    <view
      class="product-persons"
      v-for="(item,index) in personList"
      :key="index"
      @click="navigateUrl"
    >
      <!-- <view class="evaluate active">已关注</view> -->
      <PersonInfo :PersonInfo="item" :type='type'/>
    </view>
      <view class="loding-more" v-if="pageNum+1<totalPage" @click="loadingMore">
          <view>点击加载更多</view> 
          <image
            src="../static/images/icon_loding_more.png"
            mode="scaleToFill"
            lazy-load="false">
          </image>
      </view>
      <view v-if="personList.length==0&&hasData">
      <noData/>
    </view>
  </view>
</template>

<script>
import Vue from "vue";
import InterServer from "@/common/config/server"
import PersonInfo from "@/components/personInfo/personInfo.vue";
import noData from '@/components/noData/noData';
export default {
  components: {
    PersonInfo,
    noData
  },
  data() {
    return {
      tagActive: 0,
      type:1,
      tag: [
        {
          tafName: "图文咨询",
          id: 0
        },
        {
          tafName: "电话咨询",
          id: 1
        }
      ],
      personList: [
      ],
      totalPage:0,
      pageNum:0,
      pageSize:10,
      hasData:false
    };
  },
  onLoad(){
    this.getMarkLoan()
  },
  onShow(){
    // #ifdef H5
        document.title=`我的关注`
    // #endif
  },
  methods: {
    //标签切换
    chooseTag(e) {
      this.tagActive = e.currentTarget.dataset.id;
    },
    //查看我的关注
    getMarkLoan(){
      Vue.showCustomLoading()
      InterServer.getMarkLoan({
         pageNum:this.pageNum,
         pageSize:this.pageSize
      }).then(res=>{
         console.log(res)
         if(res.code==200){
            uni.hideLoading();
            this.personList=this.personList.concat(res.data);
            this.totalPage=res.data.totalPage
            this.hasData=true
         }
      })
    },
    //页面跳转
    navigateUrl() {
      let url = `./consultantDetails`;
      Vue.customNavigateTo(url);
    },
   //点击加载更多
    loadingMore(){
     this.pageNum=this.pageNum+1
      if(this.pageNum<=this.totalPage){
         this.getMarkLoan()
      }
    },
  }
};
</script>

<style lang="less" scoped>
.consultant-page {
  background: #f4f4f4;
  overflow: hidden;
  .product-persons {
    margin: 20upx 25upx;
    background: #ffffff;
    border-radius: 10upx;
    box-shadow: 0 0 20upx 5upx #f3f4f6;
    position: relative;
    .evaluate {
      position: absolute;
      right: 30upx;
      top: 37upx;
      font-size: 26upx;
    }
    .active {
      color: #1b65fa;
    }
  }
}
</style>
